﻿using System;

namespace BitPositionCheckValue
{
    class BitPositionCheckValue
    {
        static void Main()
        {
            Console.Write("Enter number: ");
            int numberV = int.Parse(Console.ReadLine());
            Console.Write("Enter bit position you want to check: ");
            int positionP = int.Parse(Console.ReadLine());
            int mask = 1 << positionP;
            int checkVal = numberV & mask;
            int result = checkVal >> positionP;
            Console.WriteLine("\nValue of the ({0})bit is:{1}", positionP, result == 1 ? 1 : 0);
        }
    }
}
